package gjtx3;

import java.util.Objects;

public class Staff implements Comparable {
    private String name;
    private int nianL;
    private String xingB;
    private String zhiW;
    private int xinShui;
    private String number;

    public  Staff(String name, int nianL, String xingB, String zhiW, int xinShui,String number) {
        this.name = name;
        this.nianL = nianL;
        this.xingB = xingB;
        this.zhiW = zhiW;
        this.xinShui = xinShui;
        this.number=number;
    }

    public String getMame() {
        return name;
    }

    public void setMame(String mame) {
        this.name = mame;
    }

    public int getNianL() {
        return nianL;
    }

    public void setNianL(int nianL) {
        this.nianL = nianL;
    }

    public String getXingB() {
        return xingB;
    }

    public void setXingB(String xingB) {
        this.xingB = xingB;
    }

    public String getZhiW() {
        return zhiW;
    }

    public void setZhiW(String zhiW) {
        this.zhiW = zhiW;
    }

    public int getXinShui() {
        return xinShui;
    }

    public void setXinShui(int xinShui) {
        this.xinShui = xinShui;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public Staff() {
    }

    @Override
    public String toString() {
        return "姓名:" + name +
                ",年龄:" + nianL +"岁"+
                ",性别：" + xingB  +
                "职务：" + zhiW  +
                "，薪水：" + xinShui+"元。"+
                "工号:"+number;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        Staff staff = (Staff) o;
        return Objects.equals(number, staff.number);
    }

    @Override
    public int hashCode() {
        return Objects.hash(number);
    }

    @Override
    public int compareTo(Object o) {
        Staff a=(Staff)o;
        return a.xinShui-this.xinShui;
    }
}
